using System;

namespace BillsDomain
{
    public class Payment : IComparable
    {
        public decimal Amount { get; set; }
        public bool IsDebit { get; set; }
        public string Payee { get; set; }
        public int ScheduledPaymentId { get; set; }
        public bool IncludeInProjection { get; set; }

        #region IComparable Members

        public virtual int CompareTo(object obj)
        {
            Payment otherAsPayment = obj as Payment;
            if (otherAsPayment == null)
            {
                throw new ArgumentException("obj is not a PaymentOnDate");
            }

            if (otherAsPayment.IsDebit == this.IsDebit)
            {
                return 0;
            }
            else if (this.IsDebit && !otherAsPayment.IsDebit)
            {
                //this is debit and the other is credit so this comes after
                return 1;
            }
            else
            {
                // this is credit and other is debit so this comes first
                return -1;
            }
        }

        #endregion
    }
}
